Skip to main content

All Questions

Tagged with
-1votes
1answer
574views

GO - How to define methods of named type?

In GO, rule is, methods can be defined only on named type and pointer to named type. In C, below code, operations are defined on type(say List), typedef struct List List; //list.h typedef struct { ...
overexchange's user avatar
5votes
2answers
4kviews

Type safety - GO vs C pointers

C is a static-typed language that is not type-safe, because pointers(void *y) let you do pretty much anything you like, even things that will crash your program. GO is also a static typed language ...
overexchange's user avatar
3votes
1answer
130views

Why are pointers of structs not printed like pointers of variables? [closed]

Consider the following code: package main import "fmt" type Vertex struct { X, Y int } var ( i = 10 p = &i v = Vertex{1,2} q = &v ) func main() { fmt.Println(p) // ...
kdnooij's user avatar

close